/**
 * creative_list.html的js代码
 */

$(document).ready(function(){
	 $.ajax({
		 	url:"/getSession",
			type:"post",	
			data: JSON.stringify({"code":0}),
		    dataType:'json',
		    contentType:'application/json;charset=UTF-8',
		    success:function(data){
				userIdentifier = data.identifier;
				if(userIdentifier == "404"){
					window.location.href = "https://fuwu.baidu.com/";
					return;
				}
			}
	 })
	 
	 $.ajax({
		 url:"/getSession",
		 type:"post",	
		 data: JSON.stringify({"code":1}),
	     dataType:'json',
	     contentType:'application/json;charset=UTF-8',
		 success:function(data){
		 	 unit = data.identifier;
			 if(unit == "404"){
			 	 window.location.href = "https://fuwu.baidu.com/";
			     return;
			 }else{
				 for(var key in unit){
					 for(var i=0;i<unit[key].length;i++){
						 for(var unitId in unit[key][i]){
							 $('#unit_select').append('<option id ='+unitId+' value='+unitId+'>'+unit[key][i][unitId]+'</opiton>');
						 }
					 }
				 }
			 }
		 }
	  });
});

$(function(){
	//返回首页
	$(".js-return-index").click(function(){
		 window.opener=null;
	     window.open('','_self');
	     window.close();
	})

    $(".del_creative").click(function(){
    	if (confirm("确定要删除这条创意吗？")) {  
            $(this).parents(".list_message").remove();
        }
    })
    $(".js-save").click(function(){
    	window.location.href='save_creative.html';
    })
    // 监听inoput输入数量
	$(".js-title").on("input",function(){
		var lenghtVal = $(this).val().length;
		var priceVal = $(this).parent().find(".title-span").find(".content-number").text().length;
		
		var newLengtVal = lenghtVal + priceVal;
		if(newLengtVal > 40){
			alert("输入长度超过范围");
		} else {
			$(this).parent().find(".title-span").find(".content-number").text(newLengtVal);
		}
	})

	$(".js-content-one").on("input",function(){
		var lenghtVal = $(this).val().length;
		var priceVal = $(this).parent().find(".title-span").find(".content-number").text().length;
		var newLengtVal = lenghtVal + priceVal;
		if(newLengtVal > 80){
			alert("输入长度超过范围");
		} else {
			$(this).parent().find(".title-span").find(".content-number").text(newLengtVal);
		}
	})

	$(".js-content-tow").on("input",function(){
		var lenghtVal = $(this).val().length;
		var priceVal = $(this).parent().find(".title-span").find(".content-number").text().length;
		var newLengtVal = lenghtVal + priceVal;
		if(newLengtVal > 80){
			alert("输入长度超过范围");
		} else {
			$(this).parent().find(".title-span").find(".content-number").text(newLengtVal);
		}
	})
 
	$(".js-content-url").on("input",function(){
		var lenghtVal = $(this).val().length;
		var priceVal = $(this).parent().find(".title-span").find(".content-number").text().length;
		var newLengtVal = lenghtVal + priceVal;
		if(newLengtVal > 36){
			alert("输入长度超过范围");
		} else {
			$(this).parent().find(".title-span").find(".content-number").text(newLengtVal);
		}
	})
	$(".js-content-visit").on("input",function(){
		var lenghtVal = $(this).val().length;
		var priceVal = $(this).parent().find(".title-span").find(".content-number").text().length;
		var newLengtVal = lenghtVal + priceVal;
		if(newLengtVal > 1024){
			alert("输入长度超过范围");
		} else {
			$(this).parent().find(".title-span").find(".content-number").text(newLengtVal);
		}
	});
	$(".js-select").change(function(){
		var options=$("#word_select option:selected"); //获取选中的项
			// url param back
		$(".fied").show();
		$('#fit_ideas').text("");
		$.post(
			'/ideaController/getUnitIdea',
			{"keyword":options.attr("value")},
			function(data,status){
			if(data!=null&&data.pageCount!=0){
					$('#fit_ideas').text("");
	                $.each(eval(data).unitIdeaList,function (i, value) { //遍历返回的json
	                	var str = "_"+i;
	                	$('#fit_ideas').append("<li class=\"list_message\" id='"+str+"'>"+	
	        					"<div class=\"cw-c-hd\">"+ value.originalityTitle+"</div>"+
	        					"<div class=\"candidate_content\">"+value.originalityDescribeOne+value.originalityDescribeTwo+"</div>"+
	        					"<div class=\"display_url\">"+value.displayURL+"</div>"+
	        					"<div class=\"operation_button\">"+
	        					"<button class=\"compile_creative js-compile-text\"><img src=\"../img/compile.png\" class=\"compile_ico\">编辑</button>"+
	        					"<button class=\"compile_creative del_creative\" onclick=\"delete_idea("+i+")\"><img src=\"../img/delgray.png\" class=\"compile_ico\">删除</button>"+
	        					"</div>"+"</li>");
	                });
	                var pageCount = eval(data ).pageCount; //取到pageCount的值(把返回数据转成object类型)
	                var currentPage = eval(data ).page; //得到currentPage
	                var options = {
	                    bootstrapMajorVersion: 2, //版本
	                    currentPage: currentPage, //当前页数
	                    totalPages: pageCount, //总页数
	                    itemTexts: function (type, page, current) {
	                        switch (type) {
	                            case "first":
	                                return "首页";
	                            case "prev":
	                                return "<<";
	                            case "next":
	                                return ">>";
	                            case "last":
	                                return "末页";
	                            case "page":
	                                return page;
	                        }
	                    },//点击事件，用于通过Ajax来刷新整个list列表
	                    onPageClicked: function (event, originalEvent, type, page) {
	                    	 $.ajax({
		                    		url:"/getSession",
		         					type:"post",	
		         					data: JSON.stringify({"code":0}),
		         				    dataType:'json',
		         				    contentType:'application/json;charset=UTF-8',
	                    			success:function(data){
	                    				userIdentifier = data.identifier;
	                    				if(userIdentifier == "404"){
	                    	    			alert("登录时间已超时，请重新从百度应用界面打开!");
	                    					return;
	                    				}
			                    	    $.ajax({
				                            url: "/ideaController/getIdeaSession",
				                            type: "post",
				                            data: JSON.stringify({"code":0,"page":page}),
				                            dataType:'json',
				         				    contentType:'application/json;charset=UTF-8',
				                            success: function (data1) {
				                                if (data1 != null) {
								            		$('#fit_ideas').text("");
									                $.each(eval(data1).unitIdeaList,function (i, value) { //遍历返回的json
									                	var str = "_"+i;
									                	$('#fit_ideas').append("<li class=\"list_message\" id='"+str+"'>"+	
									        					"<div class=\"cw-c-hd\">"+ value.originalityTitle+"</div>"+
									        					"<div class=\"candidate_content\">"+value.originalityDescribeOne+value.originalityDescribeTwo+"</div>"+
									        					"<div class=\"display_url\">"+value.displayURL+"</div>"+
									        					"<div class=\"operation_button\">"+
									        					"<button class=\"compile_creative js-compile-text\"><img src=\"../img/compile.png\" class=\"compile_ico\">编辑</button>"+
									        					"<button class=\"compile_creative del_creative\" onclick=\"delete_idea("+i+")\"><img src=\"../img/delgray.png\" class=\"compile_ico\">删除</button>"+
									        					"</div>"+"</li>");
									                });
				                                    }
				                                    var pageCount = eval(data1 ).pageCount; //取到pageCount的值(把返回数据转成object类型)
				                                    var currentPage = eval(data1 ).page; //得到currentPage
				                                    var options = {
				                                            bootstrapMajorVersion: 2, //版本
				                                            currentPage: currentPage, //当前页数
				                                            totalPages: pageCount, //总页数
				                                            itemTexts: function (type, page, current) {
				                                                switch (type) {
				                                                    case "first":
				                                                        return "首页";
				                                                    case "prev":
				                                                        return "<<";
				                                                    case "next":
				                                                        return ">>";
				                                                    case "last":
				                                                        return "末页";
				                                                    case "page":
				                                                        return page;
				                                                }
				                                            }
				                                    };
				                                    $('#example').bootstrapPaginator(options);
				                                }
				                        });
	                    			}
	                    	 });
	                    }
                    }
                	$('#example').bootstrapPaginator(options);
                	$(".fied").hide();
				}else{
					$('#fit_ideas').append("<li class=\"list_message\">"+"暂无搜索结果，请尝试替换搜索词！"+"</li>");
					$('#example').html("");
					$(".fied").hide();
				}		
		}).error(function(){
			alert("请求失败！请重新请求！");
			$(".fied").hide();
			window.location.href="https://fuwu.baidu.com/";
		});
    });
	$(document).ready(function(){
		$(".fied").show();
		var urlinfo = window.location.href;
		var keyword = urlinfo.split("?")[1];
		var searchword = decodeURI(keyword);
		var tabflags = searchword.split("--")[0]; 
		var tabflag = tabflags.toString();
		var firstSearchKw = new Array();		
		if( tabflag == "keyword=tab1"){
			$("#kou").html("当前单元:");
			var keyWord2 = searchword.split("--")[1].split(",");
			var keyWord1 = new Array();
			keyWord1[0] = keyWord2[0];
			var sum = 1;
			var isNew = new Boolean(1);
			for(var i=1;i<keyWord2.length;i++){
				for(var j=0;j<sum;j++){
					if(keyWord1[j]!=null){
						if(keyWord1[j].split("-")[0] == keyWord2[i].split("-")[0]){
						keyWord1[j] = keyWord1[j] +","+ keyWord2[i].split("-")[2];
						break;
					}else{
						for(var k=0;k<sum;k++){
							if (keyWord1[k].split("-")[0] == keyWord2[i].split("-")[0]) {
								isNew = false;
								break;
							}
						}
						if (isNew) {
							keyWord1[sum] = keyWord2[i];
							sum++;
							break;
						}
						isNew = true;
					}
				}
			}
			}
			for(var i=0;i<keyWord1.length-1;i++){
				$('#word_select').append('<option id ='+keyWord1[i].split("-")[0]+' value='+keyWord1[i].split("-")[2]+'>'+keyWord1[i].split("-")[1]+'</opiton>');
			}
			firstSearchKw[0] = keyWord1[0].split("-")[2];
		}else{
			$("#kou").html("当前关键词:");
			var keyWord2 = searchword.split("--")[1].split(",",-1);

			for(var i=0;i<keyWord2.length;i++){
				if(keyWord2[i]!=null&&keyWord2[i]!=""){
					$('#word_select').append('<option id ='+100+' value='+keyWord2[i]+'>'+keyWord2[i]+'</opiton>');
				}
			}
			firstSearchKw[0] = keyWord2[0];
		}
	$.ajax({
			url:"/getSession",
			type:"post",	
			data: JSON.stringify({"code":0}),
		    dataType:'json',
		    contentType:'application/json;charset=UTF-8',
			success:function(data){
				userIdentifier = data.identifier;
				if(userIdentifier == "404"){
	    			alert("登录时间已超时，请重新从百度应用界面打开!");
					return;
					
				}else{
		
		// url param back
		$.post(
			'/ideaController/getUnitIdea',
			{"keyword":firstSearchKw[0]},
			function(data,status){
						if(data!=null&&data.pageCount!=0){
							$('#fit_ideas').text("");
			                $.each(eval(data).unitIdeaList,function (i, value) { //遍历返回的json
			                	var str = "_"+i;
			                	$('#fit_ideas').append("<li class=\"list_message\" id='"+str+"'>"+	
			        					"<div class=\"cw-c-hd\">"+ value.originalityTitle+"</div>"+
			        					"<div class=\"candidate_content\">"+value.originalityDescribeOne+value.originalityDescribeTwo+"</div>"+
			        					"<div class=\"display_url\">"+value.displayURL+"</div>"+
			        					"<div class=\"operation_button\">"+
			        					"<button class=\"compile_creative js-compile-text\"><img src=\"../img/compile.png\" class=\"compile_ico\">编辑</button>"+
			        					"<button class=\"compile_creative del_creative\" onclick=\"delete_idea("+i+")\"><img src=\"../img/delgray.png\" class=\"compile_ico\">删除</button>"+
			        					"</div>"+"</li>");
			                });
			                var pageCount = eval(data ).pageCount; //取到pageCount的值(把返回数据转成object类型)
			                var currentPage = eval(data ).page; //得到urrentPage
			                var options = {
			                    bootstrapMajorVersion: 2, //版本
			                    currentPage: currentPage, //当前页数
			                    totalPages: pageCount, //总页数
			                    itemTexts: function (type, page, current) {
			                        switch (type) {
			                            case "first":
			                                return "首页";
			                            case "prev":
			                                return "<<";
			                            case "next":
			                                return ">>";
			                            case "last":
			                                return "末页";
			                            case "page":
			                                return page;
			                        }
			                    },//点击事件，用于通过Ajax来刷新整个list列表
			                    onPageClicked: function (event, originalEvent, type, page) {
			                    	 $.ajax({
				                    		url:"/getSession",
				         					type:"post",	
				         					data: JSON.stringify({"code":0}),
				         				    dataType:'json',
				         				    contentType:'application/json;charset=UTF-8',
			                    			success:function(data){
			                    				userIdentifier = data.identifier;
			                    				if(userIdentifier == "404"){
			                    	    			alert("登录时间已超时，请重新从百度应用界面打开!");
			                    					return;
			                    				}
					                    	    $.ajax({
						                            url: "/ideaController/getIdeaSession",
						                            type: "post",
						                            data: JSON.stringify({"code":0,"page":page}),
						                            dataType:'json',
						         				    contentType:'application/json;charset=UTF-8',
						                            success: function (data1) {
						                                if (data1 != null&&data1.pageCount!=0) {
										            		$('#fit_ideas').text("");
											                $.each(eval(data1).unitIdeaList,function (i, value) { //遍历返回的json
											                	var str = "_"+i;
											                	$('#fit_ideas').append("<li class=\"list_message\" id='"+str+"'>"+	
											        					"<div class=\"cw-c-hd\">"+ value.originalityTitle+"</div>"+
											        					"<div class=\"candidate_content\">"+value.originalityDescribeOne+value.originalityDescribeTwo+"</div>"+
											        					"<div class=\"display_url\">"+value.displayURL+"</div>"+
											        					"<div class=\"operation_button\">"+
											        					"<button class=\"compile_creative js-compile-text\"><img src=\"../img/compile.png\" class=\"compile_ico\">编辑</button>"+
											        					"<button class=\"compile_creative del_creative\" onclick=\"delete_idea("+i+")\"><img src=\"../img/delgray.png\" class=\"compile_ico\">删除</button>"+
											        					"</div>"+"</li>");
											                });
						                                    }
						                                    var pageCount = eval(data1 ).pageCount; //取到pageCount的值(把返回数据转成object类型)
						                                    var currentPage = eval(data1 ).page; //得到currentPage
						                                    var options = {
						                                            bootstrapMajorVersion: 2, //版本
						                                            currentPage: currentPage, //当前页数
						                                            totalPages: pageCount, //总页数
						                                            itemTexts: function (type, page, current) {
						                                                switch (type) {
						                                                    case "first":
						                                                        return "首页";
						                                                    case "prev":
						                                                        return "<<";
						                                                    case "next":
						                                                        return ">>";
						                                                    case "last":
						                                                        return "末页";
						                                                    case "page":
						                                                        return page;
						                                                }
						                                            }
						                                    };
						                                    $('#example').bootstrapPaginator(options);
						                                }
						                        });
			                    			}
			                    	 });
			                    }
		                    }
		                	$('#example').bootstrapPaginator(options);
		                	$(".fied").hide();
						}else{
							$('#fit_ideas').append("<li class=\"list_message\">"+"暂无搜索结果，请尝试替换搜索词！"+"</li>");
							$('#example').html("");
							$(".fied").hide();
						}
					}).error(function(){
						alert("请求失败！请重新请求！");
						$(".fied").hide();
						window.location.href="https://fuwu.baidu.com/";
					});
				}
			}
		});
	})
	
	
	// 编辑文本
	$(document).on("click",".js-compile-text", function(){
		$(this).parent().parent().find(".cw-c-hd").text();
		var textVal = $(this).parent().parent().find(".cw-c-hd").text();
		
		$(this).parents(".am-u-lg-7").siblings(".am-u-lg-5").find(".js-title").val(textVal);
		var compileLenght  = $(this).parent().parent().find(".cw-c-hd").text().length;

		$(this).parents(".am-u-lg-7").siblings(".am-u-lg-5").find(".js-number-title").text(compileLenght);
		
		
		var desc = $(this).parent().parent().find(".candidate_content").text();
		var desc_len = $(this).parent().parent().find(".candidate_content").text().length;
		var desc_one = desc.substring(0,desc_len/2);
		var desc_two = desc.substring(desc_len/2,desc_len+1);
		var desc_one_len = desc_one.length;
		var desc_two_len = desc_two.length;
		
		var url = $(this).parent().parent().find(".display_url").text();
		var url_len = $(this).parent().parent().find(".display_url").text().length;
		
		$(this).parents(".am-u-lg-7").siblings(".am-u-lg-5").find(".js-desc-one").val(desc_one);
		$(this).parents(".am-u-lg-7").siblings(".am-u-lg-5").find(".js-content-one-munber").text(desc_one_len);
		
		$(this).parents(".am-u-lg-7").siblings(".am-u-lg-5").find(".js-desc-two").val(desc_two);
		$(this).parents(".am-u-lg-7").siblings(".am-u-lg-5").find(".js-content-two-munber").text(desc_two_len);
		
		$(this).parents(".am-u-lg-7").siblings(".am-u-lg-5").find(".js-url").val(url);
		$(this).parents(".am-u-lg-7").siblings(".am-u-lg-5").find(".js-show-url-munber").text(url_len);
	})


	// 预览
	$(".js-previev").click(function(){
		$(".js-open").show();
		var title = $(this).parent(".am-panel-bd").find(".js-title").val();
		var content1 = $(this).parent(".am-panel-bd").find(".js-content-one").val();
		var content2 = $(this).parent(".am-panel-bd").find(".js-content-tow").val();
		var showUrl = $(this).parent(".am-panel-bd").find(".js-content-url").val();
		var visitUrl = $(this).parent(".js-content-visit").find(".js-content-url").val();
		$(".js-open").find(".cw-c-hd").text(title);
		$(".js-open").find(".candidate_content").text(content1 + content2);
		$(".js-open").find(".content-url").text(showUrl);
		$(".js-open").find(".visit-url").text(visitUrl);
	})

	// 关闭
	$(".js-delgrayImg").click(function(){
		$(".js-open").hide();
	})
	
	$(".js-save-button").click(function(){
		var unitId=$("#unit_select option:selected").attr("value"); //获取选中的单元id
		var title = $(this).parent(".am-panel-bd").find(".js-title").val();
		var content1 = $(this).parent(".am-panel-bd").find(".js-content-one").val();
		var content2 = $(this).parent(".am-panel-bd").find(".js-content-tow").val();
		var showUrl = $(this).parent(".am-panel-bd").find(".js-content-url").val();
		var visitUrl = $(this).parent(".am-panel-bd").find(".js-content-visit").val();	
		var userIdentifier;
		if(unitId==null ||unitId =="undefined"){
			alert("请选择创意单元！");
			return;
		}
		if(title.length > 40||content1.length > 80||content2.length > 80||showUrl.length > 36||visitUrl.length > 1024){
			alert("信息长度超出范围，请检查后再保存");
			return;
		}else if(title.length <= 0||content1.length <= 0||content2.length <= 0||showUrl.length <= 0||visitUrl.length <= 0){
			alert("创意信息部分为空，请检查后再保存");
			return;
		}
		$.ajax({
			url:"/getSession",
			type:"post",	
			data: JSON.stringify({"code":0}),
		    dataType:'json',
		    contentType:'application/json;charset=UTF-8',
		    			success:function(data){
				userIdentifier = data.identifier;
				if(userIdentifier == "404"){
					alert("登录时间已超时，请重新从百度应用界面打开!");
					return;
				}
				$.ajax({
				type: "POST",
				url: "/ideaController/ideaOperation",
				data: JSON.stringify({"ideaTitle":title,"ideaDesOne":content1,"ideaDesTwo":content2,"displayUrl":showUrl,"visitUrl":visitUrl,"userId":userIdentifier,"adgroupId":unitId,"code":0}),
				dataType:'json',
				contentType:'application/json;charset=UTF-8',
				success: function(){
					alert( "创意保存成功");
				},
				error: function(){
					alert( "创意保存失败");
				}
				});
			}
		}); 
	});
	function setIfOpen(val) {
		document.cookie = "ifOpen=" + val;
		//console.log(val);
	}

	function getIfOpenVal(param) {
		var strCookie = document.cookie;
		var arrCookie = strCookie.split(";");
		for (var i = 0; i < arrCookie.length; i++) {
			var arr = arrCookie[i].split("=");
			if (arr[0] == param)
				return arr[1];
		}
		return null;
	}
	
	//收缩服务
	var ifOpen = getIfOpenVal("ifOpen");
	console.log("ifOpen value:"+ifOpen);
	
	// index页面默认展开浮窗
	if(ifOpen == 0){
		$(".business-bridge-iframe").animate({
			left : "-230px",
		}, 0)
		$(".js-shrink-button").find("span").removeClass("control").text("服务指导");
			$(".js-shrink-button").toggle(function(){
				$(".business-bridge-iframe").animate({
					left : "0px",
				}, 1000)
				$(this).find("span").addClass("control").text("收起");
				setIfOpen(1);
			}, function() {
			$(".business-bridge-iframe").animate({
            left:"-230px",
        },1000)
        	$(this).find("span").removeClass("control").text("服务指导");
			setIfOpen(0);
		})
	}else{
		$(".js-shrink-button").toggle(function() {
			$(".business-bridge-iframe").animate({
				left : "-230px",
			}, 1000)
			$(this).find("span").removeClass("control").text("服务指导");
			setIfOpen(0);
    },function(){
        $(".business-bridge-iframe").animate({
            left:"0px",
        },1000)
        $(this).find("span").addClass("control").text("收起");
        setIfOpen(1);
    })
    }
    
     // 关闭浮窗
    $(".js-off-white").click(function(){
        $(".business-bridge-iframe").hide();
    })
    
	$(".js-save_upload").click(function(){
	$(".fied").show();
	var unitId=$("#unit_select option:selected").attr("value"); //获取选中的单元id
	var title = $(this).parent(".am-panel-bd").find(".js-title").val();
	var content1 = $(this).parent(".am-panel-bd").find(".js-content-one").val();
	var content2 = $(this).parent(".am-panel-bd").find(".js-content-tow").val();
	var showUrl = $(this).parent(".am-panel-bd").find(".js-content-url").val();
	var visitUrl = $(this).parent(".am-panel-bd").find(".js-content-visit").val();	
	var userIdentifier;
	if(unitId==null ||unitId =="undefined"){
		alert("请选择创意单元！");
		return;
	}
	if(title.length > 40||content1.length > 80||content2.length > 80||showUrl.length > 36||visitUrl.length > 1024){
		alert("信息长度超出范围，请检查后再保存");
		return;
	}else if(title.length <= 0||content1.length <= 0||content2.length <= 0||showUrl.length <= 0||visitUrl.length <= 0){
		alert("创意信息部分为空，请检查后再保存");
		return;
	}
	$.ajax({
		url:"/getSession",
		type:"post",	
		data: JSON.stringify({"code":0}),
	    dataType:'json',
	    contentType:'application/json;charset=UTF-8',
		success:function(data){
			userIdentifier = data.identifier;
			if(userIdentifier == "404"){
				alert("登录时间已超时，请重新从百度应用界面打开!");
				return;
			}
			$.ajax({
			type: "POST",
			url: "/ideaController/ideaOperation",
			data: JSON.stringify({"ideaTitle":title,"ideaDesOne":content1,"ideaDesTwo":content2,"displayUrl":showUrl,"visitUrl":visitUrl,"userId":userIdentifier,"adgroupId":unitId,"code":2}),
			dataType:'json',
			contentType:'application/json;charset=UTF-8',
			success: function(data){
				if(data.code == 410){
					alert("创意保存与上传成失败，可能是以下原因导致的："+data.msg);
					$(".fied").hide();
					return;
				}
				alert( "创意保存并上传成功");
				$(".fied").hide();
			}
			});
		}
		}); 
	});
})



function delete_idea(i){
   	//console.log(i);
   	var str = "_"+i;
   	$('#fit_ideas').find("li[id='"+str+"']").remove();
}





function get_other_page(i){
	var words = $("input:hidden[name='_result']").val();
	//console.log(words);
	$.post(
			'/ideaController/getOtherPageIdea',
			{keyword:words,page:i},
			function(data,status)
			{
				//console.log(data);
				$('#fit_ideas').find("li").remove();
				$(data.searchResult).each(function (i, value)
				{
					var str = "ysIdea"+i;
					$('#fit_ideas').append("<li class=\"list_message\" id='"+str+"'>"+	
					"<div class=\"cw-c-hd\">"+ value.originalityTitle+"</div>"+
					"<div class=\"candidate_content\">"+value.originalityDescribeOne+value.originalityDescribeTwo+"</div>"+
					"<div class=\"display_url\">"+value.displayURL+"</div>"+
					"<div class=\"operation_button\">"+
					"<button class=\"compile_creative js-compile-text\"><img src=\"../img/compile.png\" class=\"compile_ico\">编辑</button>"+
					"<button class=\"compile_creative del_creative\" onclick=\"delete_idea("+i+")\"><img src=\"../img/delgray.png\" class=\"compile_ico\">删除</button>"+
					"</div>"+"</li>");
				});					
			}
		);
}
